package com.example.first_android_project;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class Act4 extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_act4);
		Button quit=(Button) findViewById(R.id.quit);
		quit.setOnClickListener(btnclick);
		SharedPreferences myPrefs = this.getSharedPreferences("mesvariablesglobales",
				0);
				String svar1 = myPrefs.getString("svar1", "nothing");
				int ivar2 = myPrefs.getInt("ivar2", 0);
				Toast.makeText(getApplicationContext(), svar1+" "+Integer.toString(ivar2),Toast.LENGTH_LONG).show();
	}
	private OnClickListener btnclick = new OnClickListener() {
		public void onClick(View v) {
		switch (v.getId()) {
		case R.id.quit:
		finish();
		break;
		}
		}
	};
}
